package sg.edu.nus.iss.billing.gui;

import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;

import sg.edu.nus.iss.billing.localization.MessageKeyManager;


/**
 * @author Rahim Low
 *
 *         The NotificationDialog class represents a modal dialog box with a
 *         textual prompt and an OK button.
 */
public class CustomerComplaintInformation extends Dialog {

	private static final long serialVersionUID = -8343630245532452112L;

	/**
	 * Constructor for the NotificationDialog class
	 *
	 * @param parent
	 *            parent frame this dialog belongs to
	 * @param title
	 *            title of this dialog
	 * @param prompt
	 *            prompt to be displayed
	 */
	public CustomerComplaintInformation(Frame parent, String title) {
		super(parent, title, true);

		// add a listener for the close window button
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				performCloseAction();
			}
		});

		setLayout(new BorderLayout(0, 0));

		JPanel panel = new JPanel();
		add(panel, BorderLayout.NORTH);
		panel.setLayout(new BorderLayout(0, 0));

		JPanel panel_1 = new JPanel();
		panel.add(panel_1, BorderLayout.NORTH);
		panel_1.setLayout(new BorderLayout(0, 0));

		JLabel lblNewLabel = new JLabel(MessageKeyManager.getMessage("label.complaintInformation"));
		lblNewLabel.setHorizontalAlignment(SwingConstants.LEFT);
		panel_1.add(lblNewLabel);

		JPanel panel_2 = new JPanel();
		panel.add(panel_2, BorderLayout.CENTER);
		panel_2.setLayout(new BorderLayout(0, 0));

		JPanel panel_4 = new JPanel();
		panel_2.add(panel_4);
		GridBagLayout gbl_panel_4 = new GridBagLayout();
		gbl_panel_4.columnWidths = new int[]{0, 0};
		gbl_panel_4.rowHeights = new int[]{0, 0, 0, 0, 0, 0};
		gbl_panel_4.columnWeights = new double[]{1.0, Double.MIN_VALUE};
		gbl_panel_4.rowWeights = new double[]{1.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
		panel_4.setLayout(gbl_panel_4);

		JPanel panel_5 = new JPanel();
		GridBagConstraints gbc_panel_5 = new GridBagConstraints();
		gbc_panel_5.insets = new Insets(0, 0, 5, 0);
		gbc_panel_5.fill = GridBagConstraints.BOTH;
		gbc_panel_5.gridx = 0;
		gbc_panel_5.gridy = 0;
		panel_4.add(panel_5, gbc_panel_5);
		GridBagLayout gbl_panel_5 = new GridBagLayout();
		gbl_panel_5.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
		gbl_panel_5.rowHeights = new int[]{0, 0, 0, 0, 0};
		gbl_panel_5.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panel_5.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		panel_5.setLayout(gbl_panel_5);

		JLabel lblNewLabel_1 = new JLabel(MessageKeyManager.getMessage("label.nric"));
		GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
		gbc_lblNewLabel_1.anchor = GridBagConstraints.WEST;
		gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_1.gridx = 0;
		gbc_lblNewLabel_1.gridy = 0;
		panel_5.add(lblNewLabel_1, gbc_lblNewLabel_1);

		JLabel lblPlaceholder = new JLabel("");
		GridBagConstraints gbc_lblPlaceholder = new GridBagConstraints();
		gbc_lblPlaceholder.fill = GridBagConstraints.HORIZONTAL;
		gbc_lblPlaceholder.insets = new Insets(0, 0, 5, 5);
		gbc_lblPlaceholder.gridx = 1;
		gbc_lblPlaceholder.gridy = 0;
		panel_5.add(lblPlaceholder, gbc_lblPlaceholder);

		JLabel lblReporter_1 = new JLabel(MessageKeyManager.getMessage("label.reporter"));
		GridBagConstraints gbc_lblReporter_1 = new GridBagConstraints();
		gbc_lblReporter_1.anchor = GridBagConstraints.WEST;
		gbc_lblReporter_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblReporter_1.gridx = 3;
		gbc_lblReporter_1.gridy = 0;
		panel_5.add(lblReporter_1, gbc_lblReporter_1);

		JLabel label_3 = new JLabel("");
		GridBagConstraints gbc_label_3 = new GridBagConstraints();
		gbc_label_3.fill = GridBagConstraints.HORIZONTAL;
		gbc_label_3.insets = new Insets(0, 0, 5, 0);
		gbc_label_3.gridx = 4;
		gbc_label_3.gridy = 0;
		panel_5.add(label_3, gbc_label_3);

		JLabel lblComplaintCategory = new JLabel(MessageKeyManager.getMessage("label.complaintCategory"));
		GridBagConstraints gbc_lblComplaintCategory = new GridBagConstraints();
		gbc_lblComplaintCategory.anchor = GridBagConstraints.WEST;
		gbc_lblComplaintCategory.insets = new Insets(0, 0, 5, 5);
		gbc_lblComplaintCategory.gridx = 0;
		gbc_lblComplaintCategory.gridy = 1;
		panel_5.add(lblComplaintCategory, gbc_lblComplaintCategory);

		JLabel label = new JLabel("");
		GridBagConstraints gbc_label = new GridBagConstraints();
		gbc_label.fill = GridBagConstraints.HORIZONTAL;
		gbc_label.insets = new Insets(0, 0, 5, 5);
		gbc_label.gridx = 1;
		gbc_label.gridy = 1;
		panel_5.add(label, gbc_label);

		JLabel lblAssignedTo = new JLabel(MessageKeyManager.getMessage("label.assignedTo"));
		GridBagConstraints gbc_lblAssignedTo = new GridBagConstraints();
		gbc_lblAssignedTo.anchor = GridBagConstraints.WEST;
		gbc_lblAssignedTo.insets = new Insets(0, 0, 5, 5);
		gbc_lblAssignedTo.gridx = 3;
		gbc_lblAssignedTo.gridy = 1;
		panel_5.add(lblAssignedTo, gbc_lblAssignedTo);

		JLabel label_4 = new JLabel("");
		GridBagConstraints gbc_label_4 = new GridBagConstraints();
		gbc_label_4.fill = GridBagConstraints.HORIZONTAL;
		gbc_label_4.insets = new Insets(0, 0, 5, 0);
		gbc_label_4.gridx = 4;
		gbc_label_4.gridy = 1;
		panel_5.add(label_4, gbc_label_4);

		JLabel lblComplaintSeverity = new JLabel(MessageKeyManager.getMessage("label.severity"));
		GridBagConstraints gbc_lblComplaintSeverity = new GridBagConstraints();
		gbc_lblComplaintSeverity.anchor = GridBagConstraints.WEST;
		gbc_lblComplaintSeverity.insets = new Insets(0, 0, 5, 5);
		gbc_lblComplaintSeverity.gridx = 0;
		gbc_lblComplaintSeverity.gridy = 2;
		panel_5.add(lblComplaintSeverity, gbc_lblComplaintSeverity);

		JLabel label_1 = new JLabel("");
		GridBagConstraints gbc_label_1 = new GridBagConstraints();
		gbc_label_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_label_1.insets = new Insets(0, 0, 5, 5);
		gbc_label_1.gridx = 1;
		gbc_label_1.gridy = 2;
		panel_5.add(label_1, gbc_label_1);

		JLabel lblUpdatedDate = new JLabel(MessageKeyManager.getMessage("label.updatedDate"));
		GridBagConstraints gbc_lblUpdatedDate = new GridBagConstraints();
		gbc_lblUpdatedDate.anchor = GridBagConstraints.WEST;
		gbc_lblUpdatedDate.insets = new Insets(0, 0, 5, 5);
		gbc_lblUpdatedDate.gridx = 3;
		gbc_lblUpdatedDate.gridy = 2;
		panel_5.add(lblUpdatedDate, gbc_lblUpdatedDate);

		JLabel label_5 = new JLabel("");
		GridBagConstraints gbc_label_5 = new GridBagConstraints();
		gbc_label_5.fill = GridBagConstraints.HORIZONTAL;
		gbc_label_5.insets = new Insets(0, 0, 5, 0);
		gbc_label_5.gridx = 4;
		gbc_label_5.gridy = 2;
		panel_5.add(label_5, gbc_label_5);

		JLabel lblReporter = new JLabel(MessageKeyManager.getMessage("label.reporter"));
		GridBagConstraints gbc_lblReporter = new GridBagConstraints();
		gbc_lblReporter.anchor = GridBagConstraints.WEST;
		gbc_lblReporter.insets = new Insets(0, 0, 0, 5);
		gbc_lblReporter.gridx = 0;
		gbc_lblReporter.gridy = 3;
		panel_5.add(lblReporter, gbc_lblReporter);

		JLabel label_2 = new JLabel("");
		GridBagConstraints gbc_label_2 = new GridBagConstraints();
		gbc_label_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_label_2.insets = new Insets(0, 0, 0, 5);
		gbc_label_2.gridx = 1;
		gbc_label_2.gridy = 3;
		panel_5.add(label_2, gbc_label_2);

		JPanel panel_10 = new JPanel();
		GridBagConstraints gbc_panel_10 = new GridBagConstraints();
		gbc_panel_10.insets = new Insets(0, 0, 5, 0);
		gbc_panel_10.fill = GridBagConstraints.BOTH;
		gbc_panel_10.gridx = 0;
		gbc_panel_10.gridy = 1;
		panel_4.add(panel_10, gbc_panel_10);
		panel_10.setLayout(new BorderLayout(0, 0));

		JSeparator separator = new JSeparator();
		panel_10.add(separator);

		JPanel pastCommentsPanel = new JPanel();
		GridBagConstraints gbc_pastCommentsPanel = new GridBagConstraints();
		gbc_pastCommentsPanel.insets = new Insets(0, 0, 5, 0);
		gbc_pastCommentsPanel.fill = GridBagConstraints.BOTH;
		gbc_pastCommentsPanel.gridx = 0;
		gbc_pastCommentsPanel.gridy = 2;
		panel_4.add(pastCommentsPanel, gbc_pastCommentsPanel);
		pastCommentsPanel.setLayout(new BorderLayout(0, 0));

		JLabel lblNewLabel_2 = new JLabel(MessageKeyManager.getMessage("label.pastComments"));
		pastCommentsPanel.add(lblNewLabel_2, BorderLayout.NORTH);

		JPanel panel_8 = new JPanel();
		pastCommentsPanel.add(panel_8, BorderLayout.CENTER);
		panel_8.setLayout(new BorderLayout(0, 0));

		JPanel panel_7 = new JPanel();
		panel_8.add(panel_7, BorderLayout.NORTH);
		panel_7.setLayout(new BorderLayout(0, 0));

		JTextArea txtrTest = new JTextArea();
		txtrTest.setLineWrap(true);
		txtrTest.setRows(5);
		txtrTest.setFont(new Font("Tahoma", Font.PLAIN, 11));
		txtrTest.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non tincidunt dui. Suspendisse bibendum sagittis dui id fermentum. Nulla luctus neque vitae lectus adipiscing pretium. Integer adipiscing, sem non malesuada porta, dui purus auctor erat, id mattis ante est eget nisl. In id diam lacus. Donec vitae ante mauris. Nulla adipiscing placerat neque, sollicitudin ullamcorper nibh tempor eget. Vivamus sollicitudin varius tristique. Ut posuere dui a lacus consequat quis hendrerit leo aliquam. Curabitur ultrices consequat odio, in rutrum tortor bibendum a. Sed sit amet odio in erat feugiat ullamcorper at quis urna. Curabitur elementum, urna ac dignissim scelerisque, tellus felis tristique risus, a ultrices mi justo vitae mauris.");

		JScrollPane scrollPane_1 = new JScrollPane();
		scrollPane_1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
		scrollPane_1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
		panel_7.add(scrollPane_1);
		scrollPane_1.setViewportView(txtrTest);

		JPanel panel_11 = new JPanel();
		GridBagConstraints gbc_panel_11 = new GridBagConstraints();
		gbc_panel_11.insets = new Insets(0, 0, 5, 0);
		gbc_panel_11.fill = GridBagConstraints.BOTH;
		gbc_panel_11.gridx = 0;
		gbc_panel_11.gridy = 3;
		panel_4.add(panel_11, gbc_panel_11);
		panel_11.setLayout(new BorderLayout(0, 0));

		JSeparator separator_1 = new JSeparator();
		panel_11.add(separator_1);

		JPanel commentsPanel = new JPanel();
		GridBagConstraints gbc_panel_7 = new GridBagConstraints();
		gbc_panel_7.fill = GridBagConstraints.BOTH;
		gbc_panel_7.gridx = 0;
		gbc_panel_7.gridy = 4;
		panel_4.add(commentsPanel, gbc_panel_7);
		commentsPanel.setLayout(new BorderLayout(0, 0));

		JLabel lblNewLabel_3 = new JLabel(MessageKeyManager.getMessage("label.comments"));
		commentsPanel.add(lblNewLabel_3, BorderLayout.NORTH);

		JPanel panel_9 = new JPanel();
		commentsPanel.add(panel_9, BorderLayout.CENTER);
		panel_9.setLayout(new BorderLayout(0, 0));

		JPanel panel_6 = new JPanel();
		panel_9.add(panel_6, BorderLayout.CENTER);
		panel_6.setLayout(new BorderLayout(0, 0));

		JScrollPane scrollPane = new JScrollPane();
		panel_6.add(scrollPane, BorderLayout.NORTH);
		scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
		scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

		JTextArea txtrTest_1 = new JTextArea();
		txtrTest_1.setLineWrap(true);
		txtrTest_1.setRows(5);
		txtrTest_1.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin non tincidunt dui. Suspendisse bibendum sagittis dui id fermentum. Nulla luctus neque vitae lectus adipiscing pretium. Integer adipiscing, sem non malesuada porta, dui purus auctor erat, id mattis ante est eget nisl. In id diam lacus. Donec vitae ante mauris. Nulla adipiscing placerat neque, sollicitudin ullamcorper nibh tempor eget. Vivamus sollicitudin varius tristique. Ut posuere dui a lacus consequat quis hendrerit leo aliquam. Curabitur ultrices consequat odio, in rutrum tortor bibendum a. Sed sit amet odio in erat feugiat ullamcorper at quis urna. Curabitur elementum, urna ac dignissim scelerisque, tellus felis tristique risus, a ultrices mi justo vitae mauris.");
		txtrTest_1.setFont(new Font("Tahoma", Font.PLAIN, 11));
		//panel_9.add(txtrTest_1);
		scrollPane.setViewportView(txtrTest_1);

		JPanel panel_3 = new JPanel();
		panel.add(panel_3, BorderLayout.SOUTH);
		GridBagLayout gbl_panel_3 = new GridBagLayout();
		gbl_panel_3.columnWidths = new int[]{0, 100, 0, 100, 0, 0};
		gbl_panel_3.rowHeights = new int[]{0, 0};
		gbl_panel_3.columnWeights = new double[]{1.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
		gbl_panel_3.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		panel_3.setLayout(gbl_panel_3);

		JButton btnNewButton_1 = new JButton(MessageKeyManager.getMessage("button.update"));
		btnNewButton_1.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				performUpdateAction();
			}
		});
		GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints();
		gbc_btnNewButton_1.insets = new Insets(0, 0, 0, 5);
		gbc_btnNewButton_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnNewButton_1.gridx = 1;
		gbc_btnNewButton_1.gridy = 0;
		panel_3.add(btnNewButton_1, gbc_btnNewButton_1);

		JButton btnNewButton_2 = new JButton(MessageKeyManager.getMessage("button.close"));
		btnNewButton_2.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				performCloseAction();
			}
		});
		GridBagConstraints gbc_btnNewButton_2 = new GridBagConstraints();
		gbc_btnNewButton_2.insets = new Insets(0, 0, 0, 5);
		gbc_btnNewButton_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnNewButton_2.gridx = 3;
		gbc_btnNewButton_2.gridy = 0;
		panel_3.add(btnNewButton_2, gbc_btnNewButton_2);


		// set size and location
		setSize(1000, 1000);
		setLocation(200, 200);
		setResizable(false);
		// pack the UI elements
		pack();
	}

	/**
	 * Method which will be called when the OK button is clicked. Inheriting
	 * classes should overwrite this with their desired implementation.
	 */
	public void performUpdateAction() {
		this.dispose();
	}

	/**
	 * Method which will be called when the CANCEL button is clicked. Inheriting
	 * classes should overwrite this with their desired implementation.
	 */
	public void performCloseAction() {
		this.dispose();
	}
}
